package com.openvid.webrtc.openvid.cmd.join_room;

import com.openvid.webrtc.openvid.cmd.AbsRequestCmd;

/**
 * @author jinyf
 */
public class CmdJoinRoom extends AbsRequestCmd<RespJoinRoom> {

    private ParamsJoinRoom mParams = new ParamsJoinRoom();

    private String mLocalParticipantName;
    private String mSessionId;
    private String mSessionToken;

    @Override
    protected String getMethodName() {
        return "joinRoom";
    }

    public void setParams(String localParticipantName, String sessionId, String sessionToken) {
        mLocalParticipantName = localParticipantName;
        mSessionId = sessionId;
        mSessionToken = sessionToken;
    }

    @Override
    protected Object getParams() {
        mParams.metadata = "{\"clientData\": \"" + mLocalParticipantName + "\"}";
        mParams.secret = "";
        mParams.session = mSessionId;
        mParams.platform = "Android " + android.os.Build.VERSION.SDK_INT;
        mParams.token = mSessionToken;
        mParams.sdkVersion = "2.22.0";
        return mParams;
    }

    @Override
    protected Class<RespJoinRoom> getResponseClass() {
        return RespJoinRoom.class;
    }
}
